package com.xoa.service.event.impl;

import com.xoa.dao.event.*;
import com.xoa.model.enclosure.Attachment;
import com.xoa.model.event.*;
import com.xoa.model.users.Users;
import com.xoa.service.event.TimeLineService;
import com.xoa.util.CookiesUtil;
import com.xoa.util.DateFormat;
import com.xoa.util.GetAttachmentListUtil;
import com.xoa.util.ToJson;
import com.xoa.util.common.L;
import com.xoa.util.common.session.SessionUtils;
import com.xoa.util.page.PageParams;
import org.apache.commons.collections4.map.HashedMap;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * Created by 张丽军 on 2017/8/30.
 */
@Service
public class TimeLineServiceImpl implements TimeLineService {
    @Resource
    TimeLineMapper timeLineMapper;
    @Resource
    TimeLineViewUserMapper timeLineViewUserMapper;
    @Resource
    TimeLineViewRoleMapper timeLineViewRoleMapper;
    @Resource
    TimeLineViewDeptMapper timeLineViewDeptMapper;
    @Resource
    TimeLinePostUserMapper timeLinePostUserMapper;
    @Resource
    TimeLinePostRoleMapper timeLinePostRoleMapper;
    @Resource
    TimeLinePostDeptMapper timeLinePostDeptMapper;

    //详情信息
    @Override
    public ToJson<TimeLine> getDetailByUuid(HttpServletRequest request, String uuid) {
        ToJson<TimeLine> toJson = new ToJson<TimeLine>(1, "error");
        try {
            TimeLine timeLine = timeLineMapper.selectByPrimaryKey(uuid);
            //附件处理
            List<Attachment> attachmentList=new ArrayList<Attachment>();
            if(timeLine.getAttachmentName()!=null&&!"".equals(timeLine.getAttachmentName())){
                attachmentList= GetAttachmentListUtil.returnAttachment(timeLine.getAttachmentName(),timeLine.getAttachmentId(),"xoa" + (String) request.getSession().getAttribute("loginDateSouse"),GetAttachmentListUtil.TIMELINE);
            }
            timeLine.setAttachmentList(attachmentList);
            //人员、部门、角色可能选择多个，所以查出的数据是一对多的。进行遍历，把多个数据用，隔开拼成字符串放到一个变量里。
            List<TimeLine> list = timeLineMapper.getDetailByUuid(uuid);
            if (list != null) {
                for (int i = 0; i < list.size(); i++) {
                    String postDeptName = timeLine.getPostDeptName();
                    String postRoleName = timeLine.getPostRoleName();
                    String viewDeptName = timeLine.getViewDeptName();
                    StringBuffer sb = new StringBuffer();
                    //遍历，拼接
                    if (i != postDeptName.length() - 1) {
                        sb.append(String.valueOf(postDeptName)).append(",");
                    } else {
                        sb.append(String.valueOf(postDeptName));
                    }
                    if (i != postRoleName.length() - 1) {
                        sb.append(String.valueOf(postRoleName)).append(",");
                    } else {
                        sb.append(String.valueOf(postRoleName));
                    }
                    if (i != viewDeptName.length() - 1) {
                        sb.append(String.valueOf(viewDeptName)).append(",");
                    } else {
                        sb.append(String.valueOf(viewDeptName));
                    }
                }
                toJson.setObject(list);
                toJson.setMsg("ok");
            } else {
                toJson.setMsg("数据为空");
            }
            toJson.setFlag(0);
        } catch (Exception e) {
            e.printStackTrace();
            toJson.setMsg(e.getMessage());
            L.e("TimeLineServiceImpl getDetailByUuid:" + e);
        }
        return toJson;
    }


    /**
     * @param request
     * @param uuid
     * @return
     * @auth 杨超
     * @time 2017-09-26
     * 通过uuid获取大事件详细信息
     */
    public ToJson<TimeLine> getTimeLineByUuid(HttpServletRequest request, String uuid) {
        ToJson<TimeLine> toJson = new ToJson<TimeLine>(1, "error");
        //获取当前用户信息用来判断用户对该事件是否具有操作权限
        Cookie redisSessionId = CookiesUtil.getCookieByName(request,"redisSessionId");
        Users users = SessionUtils.getSessionInfo(request.getSession(),Users.class,new Users(),redisSessionId);

        TimeLine timeLine = timeLineMapper.selectTimeLineByUuid(uuid);

        //附件处理
        List<Attachment> attachmentList=new ArrayList<Attachment>();
        if(timeLine.getAttachmentName()!=null&&!"".equals(timeLine.getAttachmentName())){
            attachmentList= GetAttachmentListUtil.returnAttachment(timeLine.getAttachmentName(),timeLine.getAttachmentId(),"xoa" + (String) request.getSession().getAttribute("loginDateSouse"),GetAttachmentListUtil.TIMELINE);
        }
        timeLine.setAttachmentList(attachmentList);

        //添加具有查看权限的人员
        List<TimeLineViewUser> timeLineViewUser = timeLineViewUserMapper.selectByUUID(uuid);
        StringBuffer name = new StringBuffer();
        StringBuffer id = new StringBuffer();
        for (TimeLineViewUser tlvu : timeLineViewUser) {
            if(tlvu.getUserId()!=null && tlvu.getUserName()!=null) {
                name.append(tlvu.getUserName() + ",");
                id.append(tlvu.getUserId() + ",");
            }
        }
        timeLine.setViewUserId(id.toString());
        timeLine.setViewUserName(name.toString());

        //添加具有查看权限的角色
        List<TimeLineViewRole> timeLineViewRoles = timeLineViewRoleMapper.selectByUUID(uuid);
        name.setLength(0);
        id.setLength(0);
        for (TimeLineViewRole tlvr : timeLineViewRoles) {
            if(tlvr.getRoleId()!=null && tlvr.getRoleName()!=null) {
                name.append(tlvr.getRoleName() + ",");
                id.append(tlvr.getRoleId() + ",");
            }
        }
        timeLine.setViewRoleId(id.toString());
        timeLine.setViewRoleName(name.toString());

        //添加具有查看权限的部门
        List<TimeLineViewDept> timeLineViewDepts = timeLineViewDeptMapper.selectByUUID(uuid);
        name.setLength(0);
        id.setLength(0);
        for (TimeLineViewDept tlvd : timeLineViewDepts) {
            if(tlvd.getDeptId()!=null && tlvd.getDeptName()!=null) {
                name.append(tlvd.getDeptName() + ",");
                id.append(tlvd.getDeptId() + ",");
            }
        }
        timeLine.setViewDeptId(id.toString());
        timeLine.setViewDeptName(name.toString());

        //添加具有修改权限的人员
        List<TimeLinePostUser> timeLinePostUsers = timeLinePostUserMapper.selectByUUID(uuid);
        name.setLength(0);
        id.setLength(0);
        for (TimeLinePostUser tlvu : timeLinePostUsers) {
            if(tlvu.getUserId()!=null && tlvu.getUserName()!=null) {
                name.append(tlvu.getUserName() + ",");
                id.append(tlvu.getUserId() + ",");
                if (tlvu.getUserId().toString().equals(users.getUserId())) {
                    timeLine.setRight(true);
                }
            }
        }
        timeLine.setPostUserId(id.toString());
        timeLine.setPostUserName(name.toString());

        //添加具有修改权限的角色
        List<TimeLinePostRole> timeLinePostPostRoles = timeLinePostRoleMapper.selectByUUID(uuid);
        name.setLength(0);
        id.setLength(0);
        for (TimeLinePostRole tlvr : timeLinePostPostRoles) {
            if(tlvr.getRoleId()!=null && tlvr.getRoleName()!=null) {
                name.append(tlvr.getRoleName() + ",");
                id.append(tlvr.getRoleId() + ",");
                if (tlvr.getRoleId() == users.getUserPriv()) {
                    timeLine.setRight(true);
                }
            }
        }
        timeLine.setPostRoleId(id.toString());
        timeLine.setPostRoleName(name.toString());

        //添加具有修改权限的部门
        List<TimeLinePostDept> imeLinePostDept = timeLinePostDeptMapper.selectByUUID(uuid);
        name.setLength(0);
        id.setLength(0);
        for (TimeLinePostDept tlvd : imeLinePostDept) {
            if(tlvd.getDeptId()!=null && tlvd.getDeptName()!=null) {
                name.append(tlvd.getDeptName() + ",");
                id.append(tlvd.getDeptId() + ",");
                if (tlvd.getDeptId() == users.getDeptId()) {
                    timeLine.setRight(true);
                }
            }
        }
        timeLine.setPostDeptId(id.toString());
        timeLine.setPostDeptName(name.toString());

        //如果为当前用户创建的 设置修改权限为true
        if(timeLine.getCrUserId() == users.getUid() ){
            timeLine.setRight(true);
        }
        toJson.setObject(timeLine);
        toJson.setMsg("ok");
        toJson.setFlag(0);
        return toJson;
    }

    /**
     * @param request
     * @param uuid
     * @return
     * @auth 杨超
     * @time 2017-09-26
     * 通过uuid获取大事件详细信息
     */
    public ToJson<Object>  getTimelineCode(HttpServletRequest request,String uuid) {

        return null;
    }

    //大事记列表信息
    @Override
    public ToJson<TimeLine> getInforList(HttpServletRequest request, TimeLine timeLine) {
        ToJson<TimeLine> toJson = new ToJson<TimeLine>(1, "error");
        Cookie redisSessionId = CookiesUtil.getCookieByName(request,"redisSessionId");
        Users users = SessionUtils.getSessionInfo(request.getSession(),Users.class,new Users(),redisSessionId);
        Map<String, Object> map = new HashedMap();
        map.put("userId", users.getUid());
        map.put("deptId", users.getDeptId());
        map.put("roleId", users.getUserPriv());
        /*map.put("postUserId",users.getUid());
        map.put("postDeptId",users.getDeptId());
        map.put("postRoleId",users.getUserPriv());*/
        try {
            if (timeLine.getCrTime() == null) {
                timeLine.setCrTime(DateFormat.getCurrentTime());
            }
            //管理员具有所有权限
            if (users.getByname().equals("admin")) {
                List<TimeLine> list1 = timeLineMapper.getInforList1(timeLine);
                if (list1 != null) {
                    toJson.setObj(list1);
                    toJson.setMsg("ok");
                } else {
                    toJson.setMsg("列表数据为空");
                }
                toJson.setFlag(0);
            } else {
                List<TimeLine> list = timeLineMapper.getInforList(timeLine);
                if (list != null) {
                    toJson.setObj(list);
                    toJson.setMsg("ok");
                } else {
                    toJson.setMsg("列表数据为空");
                }
                toJson.setFlag(0);
            }

        } catch (Exception e) {
            e.printStackTrace();
            toJson.setMsg(e.getMessage());
            L.e("TimeLineServiceImpl getInforList:" + e);
        }
        return toJson;
    }

    //大事记管理列表信息
    @Override
    public ToJson<TimeLine> getInforList1(HttpServletRequest request, TimeLine timeLine) {
        ToJson<TimeLine> toJson = new ToJson<TimeLine>(1, "error");
        Cookie redisSessionId = CookiesUtil.getCookieByName(request,"redisSessionId");
        Users users = SessionUtils.getSessionInfo(request.getSession(),Users.class,new Users(),redisSessionId);
        Map<String, Object> map = new HashedMap();
        map.put("userId", users.getUid());
        map.put("deptId", users.getDeptId());
        map.put("roleId", users.getUserPriv());
        /*map.put("postUserId",users.getUid());
        map.put("postDeptId",users.getDeptId());
        map.put("postRoleId",users.getUserPriv());*/
        try {
            if (timeLine.getCrTime() == null) {
                timeLine.setCrTime(DateFormat.getCurrentTime());
            }
            List<TimeLine> list = timeLineMapper.getInforList1(timeLine);
            if (list != null) {
                toJson.setObj(list);
                toJson.setMsg("ok");
            } else {
                toJson.setMsg("列表数据为空");
            }
            toJson.setFlag(0);
        } catch (Exception e) {
            e.printStackTrace();
            toJson.setMsg(e.getMessage());
            L.e("TimeLineServiceImpl getInforList1:" + e);
        }
        return toJson;
    }

    //编辑接口
    @Override
    public ToJson<TimeLine> updateData(HttpServletRequest request, TimeLine timeLine, TimeLinePostDept timeLinePostDept,
                                       TimeLinePostRole timeLinePostRole, TimeLinePostUser timeLinePostUser,
                                       TimeLineViewDept timeLineViewDept, TimeLineViewRole timeLineViewRole, TimeLineViewUser timeLineViewUser,
                                       String post1, String post2, String post3, String view1, String view2, String view3) {
        ToJson<TimeLine> toJson = new ToJson<>(1, "error");
        try {
            timeLinePostDept.setTimelineId(timeLine.getUuid());
            timeLinePostDeptMapper.deleteByPrimaryKey(timeLinePostDept.getTimelineId());

            //具有修改权限的部门
            if (post3 != null && !"".equals(post3)) {
                String[] strArrary1 = post3.split(",");
                for (int i = 0; i < strArrary1.length; i++) {
                    timeLinePostDept.setDeptId(Integer.valueOf(strArrary1[i]));
                    timeLinePostDept.setTimelineId(timeLine.getUuid());
                    timeLinePostDeptMapper.addTimeLinePostDept(timeLinePostDept);
                }
            }
            //具有修改权限的角色
            timeLinePostRole.setTimelineId(timeLine.getUuid());
            timeLinePostRoleMapper.deleteByPrimaryKey(timeLinePostRole.getTimelineId());
            if (post2 != null && !"".equals(post2)) {
                String[] strArrary2 = post2.split(",");
                for (int i = 0; i < strArrary2.length; i++) {
                    timeLinePostRole.setRoleId(Integer.valueOf(strArrary2[i]));
                    timeLinePostRole.setTimelineId(timeLine.getUuid());
                    timeLinePostRoleMapper.addTimeLinePostRole(timeLinePostRole);
                }
            }
            //具有修改权限的人员
            timeLinePostUser.setTimelineId(timeLine.getUuid());
            timeLinePostUserMapper.deleteByPrimaryKey(timeLinePostUser.getTimelineId());
            if (post1 != null && !"".equals(post1)) {
                String[] strArrary3 = post1.split(",");
                for (int i = 0; i < strArrary3.length; i++) {
                    timeLinePostUser.setUserId(strArrary3[i]);
                    timeLinePostUser.setTimelineId(timeLine.getUuid());
                    timeLinePostUserMapper.addTimeLinePostUser(timeLinePostUser);
                }
            }

            //具有查看权限的部门
            timeLineViewDept.setTimelineId(timeLine.getUuid());
            timeLineViewDeptMapper.deleteByPrimaryKey(timeLineViewDept.getTimelineId());
            if (view3 != null && !"".equals(view3)) {
                String[] strArrary4 = view3.split(",");
                for (int i = 0; i < strArrary4.length; i++) {
                    timeLineViewDept.setDeptId(Integer.valueOf(strArrary4[i]));
                    timeLineViewDept.setTimelineId(timeLine.getUuid());
                    timeLineViewDeptMapper.addTimeLineViewDept(timeLineViewDept);
                }
            }
            timeLineViewRole.setTimelineId(timeLine.getUuid());
            timeLineViewRoleMapper.deleteByPrimaryKey(timeLineViewRole.getTimelineId());
            if (view2 != null && !"".equals(view2)) {
                String[] strArrary5 = view2.split(",");
                for (int i = 0; i < strArrary5.length; i++) {
                    timeLineViewRole.setRoleId(Integer.valueOf(strArrary5[i]));
                    timeLineViewRole.setTimelineId(timeLine.getUuid());
                    timeLineViewRoleMapper.addTimeLineViewRole(timeLineViewRole);
                }
            }

            timeLineViewUser.setTimelineId(timeLine.getUuid());
            timeLineViewUserMapper.deleteByPrimaryKey(timeLineViewUser.getTimelineId());
            if (view1 != null && !"".equals(view1)) {
                String[] strArrary6 = view1.split(",");
                for (int i = 0; i < strArrary6.length; i++) {
                    timeLineViewUser.setUserId(strArrary6[i]);
                    timeLineViewUser.setTimelineId(timeLine.getUuid());
                    timeLineViewUserMapper.addTimeLineViewUser(timeLineViewUser);
                }
            }
            if (timeLine.getCrTime() == null) {
                timeLine.setCrTime(DateFormat.getCurrentTime());
            }
            if (timeLine.getTag() == null) {
                timeLine.setTag("");
            }
            int a = timeLineMapper.updateData(timeLine);
            if (a > 0) {
                toJson.setMsg("ok");
                toJson.setFlag(0);
            } else {
                toJson.setMsg("更新失败");
                toJson.setFlag(1);
            }
        } catch (Exception e) {
            e.printStackTrace();
            toJson.setMsg(e.getMessage());
            L.e("TimeLineServiceImpl updateData:" + e);
        }
        return toJson;
    }


    @Override
    public ToJson<TimeLine> addData(HttpServletRequest request, TimeLine timeLine, String post1, String post2, String post3, String view1, String view2, String view3) {
        ToJson<TimeLine> toJson = new ToJson<>(1, "error");
        try {
            //新增主键，由于主键是String型，所以不能自动生成。
            String uuid = UUID.randomUUID().toString().replaceAll("-", "");
            timeLine.setUuid(uuid);

            //添加创建人信息
            Cookie redisSessionId = CookiesUtil.getCookieByName(request,"redisSessionId");
            Users users = SessionUtils.getSessionInfo(request.getSession(),Users.class,new Users(),redisSessionId);
            timeLine.setCrUserId(users.getUid());

            //字符串解析成数组,去逗号，强制转换成int型，依次存入数据表中

            // 修改部门
            TimeLinePostDept timeLinePostDept = new TimeLinePostDept();
            if (post3 != null && !"".equals(post3)) {
                String[] strArrary1 = post3.split(",");
                for (int i = 0; i < strArrary1.length; i++) {
                    timeLinePostDept.setTimelineId(uuid);
                    timeLinePostDept.setDeptId(Integer.valueOf(strArrary1[i]));
                    timeLinePostDeptMapper.addTimeLinePostDept(timeLinePostDept);
                }
            }

            // 修改角色
            if (post2 != null && !"".equals(post2)) {
                TimeLinePostRole timeLinePostRole = new TimeLinePostRole();
                String[] strArrary2 = post2.split(",");
                for (int i = 0; i < strArrary2.length; i++) {
                    timeLinePostRole.setTimelineId(uuid);
                    timeLinePostRole.setRoleId(Integer.valueOf(strArrary2[i]));
                    timeLinePostRoleMapper.addTimeLinePostRole(timeLinePostRole);
                }
            }
            //修改人员
            if (post1 != null && !"".equals(post1)) {
                TimeLinePostUser timeLinePostUser = new TimeLinePostUser();
                String[] strArrary3 = post1.split(",");
                for (int i = 0; i < strArrary3.length; i++) {
                    timeLinePostUser.setTimelineId(uuid);
                    timeLinePostUser.setUserId(strArrary3[i]);
                    timeLinePostUserMapper.addTimeLinePostUser(timeLinePostUser);
                }
            }
            //查看人员
            if (view3 != null && !"".equals(view3)) {
                TimeLineViewDept timeLineViewDept = new TimeLineViewDept();
                String[] strArrary4 = view3.split(",");
                for (int i = 0; i < strArrary4.length; i++) {
                    timeLineViewDept.setTimelineId(uuid);
                    timeLineViewDept.setDeptId(Integer.valueOf(strArrary4[i]));
                    timeLineViewDeptMapper.addTimeLineViewDept(timeLineViewDept);
                }
            }
            //查看部门
            if (view2 != null && !"".equals(view2)) {
                TimeLineViewRole timeLineViewRole = new TimeLineViewRole();
                String[] strArrary5 = view2.split(",");
                for (int i = 0; i < strArrary5.length; i++) {
                    timeLineViewRole.setTimelineId(uuid);
                    timeLineViewRole.setRoleId(Integer.valueOf(strArrary5[i]));
                    timeLineViewRoleMapper.addTimeLineViewRole(timeLineViewRole);
                }
            }
            //查看角色
            if (view1 != null && !"".equals(view1)) {
                TimeLineViewUser timeLineViewUser = new TimeLineViewUser();
                String[] strArrary6 = view1.split(",");
                for (int i = 0; i < strArrary6.length; i++) {
                    timeLineViewUser.setTimelineId(uuid);
                    timeLineViewUser.setUserId(strArrary6[i]);
                    timeLineViewUserMapper.addTimeLineViewUser(timeLineViewUser);
                }
            }

            if (timeLine.getCrTime() == null) {
                timeLine.setCrTime(DateFormat.getCurrentTime());
            }
            if (timeLine.getTag() == null) {
                timeLine.setTag("");
            }
            int a = timeLineMapper.addData(timeLine);

            if (a > 0) {
                toJson.setMsg("ok");
                toJson.setFlag(0);
            } else {
                toJson.setMsg("更新失败");
                toJson.setFlag(1);
            }
        } catch (Exception e) {
            e.printStackTrace();
            toJson.setMsg(e.getMessage());
            L.e("TimeLineServiceImpl addDate:" + e);
        }
        return toJson;
    }


    @Override
    public ToJson<TimeLine> deleteByUuid(HttpServletRequest request, String uuid) {
        ToJson<TimeLine> toJson = new ToJson<>(1, "error");
        try {
            int a = timeLineMapper.deleteByUuid(uuid);
            if (a > 0) {
                toJson.setMsg("ok");
                toJson.setFlag(0);
            } else {
                toJson.setMsg("删除失败");
                toJson.setFlag(1);
            }
        } catch (Exception e) {
            e.printStackTrace();
            toJson.setMsg(e.getMessage());
            L.e("TimeLineServiceImpl deleteByUuid:" + e);
        }
        return toJson;
    }

    /**
     * 获取当前用户有权查看的大事件
     *
     * @auth: 杨超
     * @time: 2017-09-25
     */
    public List<TimeLine> getTimelines(HttpServletRequest request) throws UnsupportedEncodingException {
        return getPageTimelines(request, null, null);
    }

    @Override
    public List<TimeLine> getPageTimelines(HttpServletRequest request, PageParams page, Map map) throws UnsupportedEncodingException {
        request.setCharacterEncoding("UTF-8");
        if (map == null) {
            map = new HashedMap();
        }
        Cookie redisSessionId = CookiesUtil.getCookieByName(request,"redisSessionId");
        Users users = SessionUtils.getSessionInfo(request.getSession(),Users.class,new Users(),redisSessionId);
        map.put("id", users.getUid());
        map.put("userID",users.getUserId());
        map.put("deptId", users.getDeptId());
        map.put("roleId", users.getUserPriv());
        if (page != null && page.getPageSize() != null && page.getPage() != null) {
            int start = page.getPageSize() * (page.getPage() - 1);
            int end = page.getPageSize();
            map.put("start", start);
            map.put("size", end);
        }
        List<TimeLine> lists = timeLineMapper.getTimelines(map);
        for (TimeLine t : lists) {
            if (postTimelines(request, null, t.getUuid()).size() > 0) {
                t.setRight(true);
            }
        }
        return lists;
    }

    /**
     * @auth: 杨超
     * 获取当前用户具有管理权限的
     */
    @Override
    public List<TimeLine> postTimelines(HttpServletRequest request, PageParams page, String uuid) {
        Cookie redisSessionId = CookiesUtil.getCookieByName(request,"redisSessionId");
        Users users = SessionUtils.getSessionInfo(request.getSession(),Users.class,new Users(),redisSessionId);
        Map<String, Object> map = new HashedMap();
        map.put("id", users.getUid());
        map.put("userID",users.getUserId());
        map.put("deptId", users.getDeptId());
        map.put("roleId", users.getUserPriv());
        map.put("title",request.getParameter("title"));
        map.put("tag",request.getParameter("tag"));
        String type = request.getParameter("type");
        if (!"000".equals(type)) {
            map.put("type",type);
        }else{
            map.put("type",null);
        }

        if (uuid != null) {
            map.put("uuid", uuid);
        }
        if (page != null && page.getPageSize() != null && page.getPage() != null) {
            int start = page.getPageSize() * (page.getPage() - 1);
            int end = page.getPageSize();
            map.put("start", start);
            map.put("size", end);
        } else {
            map.put("start", 0);
            map.put("size", 10);
        }
        List<TimeLine> lists = timeLineMapper.postTimelines(map);
        for (TimeLine t : lists) {
            t.setRight(true);
            if ("001".equals(t.getType())) {
                t.setType("工程项目");
            } else if ("002".equals(t.getType())) {
                t.setType("会议活动");
            }
        }
        return lists;
    }

}
